Pike v0.4 manual
This manual is far from complete, it still needs a lot of work to cover
all the aspects required of a good manual. However, I hope that it is
still useful in it's present state.
Getting started
For now this section is made up of example code with line by line
explanations. If there is a word you don't understand I suggest you
look it up in the index first time you encouter it because it might
be essential to understanding that piece of code.
- example1 - Let's write a small Pike program:
- example2 - Now we will look at a slightly more useful example:
- example3 - This example is a very simple www-server.
Control structures groups code into blocks and they control the order in
which statements are executed. Control structures in Pike are basically
the same as those in C, with a few exceptions.
- break - break a loop or switch
- catch - catch errors
- continue - continue a loop
- do-while - execute a statement while an expression is true
- for - generic loop statement
- foreach - loop over an array
- gauge - measure system time
- if-else - run on condition
- return - return from a function
- switch - Complicated conditional statement
- while - execute a statement while an expression is true
Data is stored in different ways, integers (eg. 1, 2, 3, 4 etc.) are
are stored in one way, real numbers (1.0, 1.1, etc.) in another. Each
different way get its own name. Pike types are part of what makes Pike
a powerful language. They make it easy to handle data without worrying
about memory management and other programming obstacles.
- array - an array of values
- float - floating point numbers
- function - a function pointer
- int - integers numbers
- mapping - an associative array
- mixed - any type
- multiset - a set of values
- object - an instance of a class (program)
- program - a class, or blueprint for an object
- string - a string of characters
This section is about the more fundamental workings of Pike, such as
how Pike compiles code and object orientation.
- cast - convert one type to another
- class - define a inlined program
- functions - how to write a function
- inherit - use definitions from another program
- lambda - write nameless functions
- modifier - modify function / variable definitions
- preprocessor - textually process code before compiling
- typeof - check return type of expression
- variables - how to declare a variable
Builtin functions
Pike has a wide range of builtin functions. Most of these are implemented
in C, but some are implemented in Pike using the add_constant function.
Here's a list of all built-in functions.
Operators
Pike operators behave much like the onces in C, but have many many additional
features. Most of this added functionality is related to the new data types.
Keyword index
The rest of the written documentation is gathered here, without much
thought about order. Hopefully you should be able to use this section
anyway once you've looked at the sections above.
File
- cd - change directory
- combine_path - concatenate paths
- file_size - return the size of a file in bytes
- file_stat - stat a file
- get_dir - read a directory
- getcwd - return current working directory
- mkdir - make directory
- mv - move a file (may handle directiories as well)
- perror - print error
- read_bytes - read a number of bytes into a string from a file
- read_file - read a number of lines into a string from file
- rm - remove file or directory
- strerror - return a string describing an error
- werror - write to stderr
- write_file - append a string to a file
Builtin programs:
Other pages
Here's a list of all pages.
Pike internals
This section of the manual tries to explain how the inside of Pike works.
It is intended for people who wants to write extentions to Pike, but
could also be useful for debugging and/or optimization.
- array - an array of values
- data_types - Pike internal data types
- error_handling - how to error handling works inside Pike
- low_level - low level routines supplied by pike
- mapping - an associative array
- object - an instance of a class (program)
- pike_string - internal pike shared strings
- program - a class, or blueprint for an object
- svalue - internal type for storing Pike values